package com.alpha.tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.alpha.bom.Answer;
import com.alpha.bom.Question;

public class QuestionTest {

	private Question question;
	private Answer answer;
	
	@Before
	public void setUp() throws Exception {
		this.answer = new Answer(0, "This is the correct answer");
		this.question = new Question(10, "MultipleChoice", "What is the first question?", this.answer, "Random");
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testCompareTo() {
		Question qTemp = null;
		int result = 0;
		
		qTemp = new Question(15, "MultipleChoice", "What is the second question?", this.answer, "Random");
		result = this.question.compareTo(qTemp);
		assertEquals(true,result<0);
		assertEquals(false,result==0);
		assertEquals(false,result>0);
		
		qTemp = new Question(10, "MultipleChoice", "What is the third question?", this.answer, "Random");
		result = this.question.compareTo(qTemp);
		assertEquals(false,result<0);
		assertEquals(true,result==0);
		assertEquals(false,result>0);
		
		qTemp = new Question(5, "MultipleChoice", "What is the fourth question?", this.answer, "Random");
		result = this.question.compareTo(qTemp);
		assertEquals(false,result<0);
		assertEquals(false,result==0);
		assertEquals(true,result>0);
	}

}
